<?


// Navi
$linkarray=$content->orderby('position')->contmedlinks->as_array();

if(count($linkarray)==0){
	return;
}


$selectedind=0;
$count=0;
foreach ($linkarray as $link){
	$media=$link->media;
	$isselected=($link->id==$this->id3);
	if($isselected){
		$selectedind=$count;
		
	}	
	$count++;
}

$nextind=$selectedind+1;
if($nextind>count($linkarray)-1){
	$nextind=0;
}


echo '<div class="mediacontainer">';
echo '<div class="mediabig">';
$link=$linkarray[$selectedind];
$nextlink=$linkarray[$nextind];
$mediabig=$link->media;


if($mediabig->extension=='flv'){
	
	$flashplayer=new View('media/flashplayer');
	$flashplayer->flashvars='exturl='.url::base().$mediabig->url;
	$href=$this->id.'/'.$this->id2.'/'.$nextlink->id;
	echo html::anchor($href,$flashplayer);

	
}else{
	$url=$link->media->get_resized_url(600,600);
	$href=$this->id.'/'.$this->id2.'/'.$nextlink->id;
	echo html::anchor($href,html::image($url));

}

echo '</div>';


if(count($linkarray)>1){
	echo '<div class="medianavi">';
	$count=0;
	foreach($linkarray as $link){
		$naviclass='';
		$overlay='';	
		if($selectedind==$count){
			$naviclass='selected';
			$overlay='<div class="imgoverlay"></div>';
		}
		
		$media=$link->media;
		$url=$media->get_resized_url(1000,60);
		echo'<div class="medianavi_elm">';	
		echo html::anchor($this->id.'/'.$this->id2.'/'.$link->id,($count+1), array('class'=>$naviclass));
		
		//echo html::anchor($this->id.'/'.$this->id2.'/'.$link->id ,html::image($url), array('class'=>$naviclass));
		//echo $overlay;
		echo '</div>';
		$count++;
	}	
	echo '</div>';
}

echo '<div class="clear"></div>';


echo '</div>';



?>